import SceneManager, { SceneType } from "../Script/framework/SceneManager";
import { TimerMgr } from "./framework/TimerMgr";
import DataMgr from "./logic/DataMgr";
import { AudioMgr, AUDIO_CONFIG } from "./framework/AudioMgr";

const {ccclass, property} = cc._decorator;

@ccclass
export default class Main extends cc.Component {

    private static m_instance: Main;
    public static get Instance() {
        return Main.m_instance;
    }

    @property(cc.Prefab)
    canvas: cc.Prefab = null;

    onLoad() {
        cc.game.addPersistRootNode(this.node);
        Main.m_instance = this;

        //ObjectManager.Instance.init();
        DataMgr.Instance.init();
        AudioMgr.Instance.play_music(AUDIO_CONFIG.Audio_Bgm);
    }

    start () {
        SceneManager.Instance.loadScene(SceneType.Login);
    }

    update(dt) {
        TimerMgr.Instance.update(dt);
    }
}